package com.loveshes.springbootstudy1.common;

import org.springframework.data.relational.core.sql.In;

/**
 * JsonData封装类
 *
 * @Author WangZhe
 * @Date 2021-12-18 21:56
 */
public class JsonResult<T> {

    public static Integer STATUS_SUCCESS = 0;
    public static Integer STATUS_FAIL = 1;

    public static <T> JsonData<T> success() {
        return success(STATUS_SUCCESS);
    }

    public static <T> JsonData<T> success(Integer code) {
        return new JsonData<T>().status(code).message("操作成功");
    }

    public static <T> JsonData<T> fail() {
        return fail(STATUS_FAIL);
    }

    public static <T> JsonData<T> fail(Integer code) {
        return new JsonData<T>().status(STATUS_FAIL).message("操作失败");
    }

}
